<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title></title>
	</head>
	<body>
	<!-- code formatted by http://manoli.net/csharpformat/ -->
<style type="text/css">
.csharpcode, .csharpcode pre
{
	font-size: 14px;
	color: black;
	font-family: Consolas, "Courier New", Courier, Monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #006080; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}

.csharpcode .lnum { color: #606060; }
</style>
<pre class="csharpcode">
<span class="kwrd">private</span> <span class="kwrd">void</span> LoadvCalendar(<span class="kwrd">string</span> p)
{
    ClearForm();

    <span class="kwrd">try</span>
    {
        StreamReader streamReader = <span class="kwrd">new</span> StreamReader(p);
        <span class="kwrd">string</span> content = streamReader.ReadToEnd();
        streamReader.Close();
        vCalendar calendar = ActiveUp.Net.Groupware.vCalendar.Parser.Parse(content);

        <span class="kwrd">if</span> (calendar.Events.Count &gt; 0)
        {
            vEvent fEvent = calendar.Events[0];
            <span class="kwrd">this</span>.objectTextbox.Text = fEvent.Summary;
            <span class="kwrd">this</span>.placeTextbox.Text = fEvent.Location;
            <span class="kwrd">this</span>.startDate.Value = <span class="kwrd">this</span>.startTime.Value = fEvent.Start;
            <span class="kwrd">this</span>.endDate.Value = <span class="kwrd">this</span>.endTime.Value = fEvent.End;
        }
        <span class="kwrd">else</span>
            MessageBox.Show(<span class="str">"No events found in the vCalendar file."</span>);
        
        <span class="kwrd">this</span>.rawDataTextbox.Text = content;
    }
    <span class="kwrd">catch</span> (Exception ex)
    {
        ClearForm();
        <span class="kwrd">throw</span> ex;
        MessageBox.Show(<span class="str">"Error while loading the vCard. Please ensure this is a compatible format."</span>);
    }
    <span class="kwrd">finally</span>
    {
        
    }
}

<span class="kwrd">private</span> <span class="kwrd">void</span> saveAsButton_Click(<span class="kwrd">object</span> sender, EventArgs e)
{
    <span class="kwrd">this</span>.savevCalendarDialog.ShowDialog();

    vCalendar calendar = <span class="kwrd">new</span> vCalendar();
    vEvent newEvent = <span class="kwrd">new</span> vEvent();
    newEvent.Summary = <span class="kwrd">this</span>.objectTextbox.Text;
    newEvent.Location = <span class="kwrd">this</span>.placeTextbox.Text;
    newEvent.Start = DateTime.Now;
    newEvent.End = DateTime.Now;
    calendar.Events.Add(newEvent);
}</pre>
	</body>
</html>
